<%--
  Created by IntelliJ IDEA.
  User: 15c
  Date: 2017/6/11
  Time: 20:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js">
    </script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#inputs1").click(function () {
                var account = $("#uname").val();
                var pass = $("#upass").val();

                $("#divPass").html("");
                $.ajax({
                    url: "http://localhost:8081/ajax_login",
                    type: "post",
                    data: {"account": account,"pass": pass},
                    dataType:"json",
                    success: function (data) {
                        if (data.data == "yes") {
                            alert(data.data)
                        } else {
                            $("#divPass").html("用户名或密码错误");
                        }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {

                    }
                });
            });
        });
    </script>
</head>
<body>
uname:<input type="text" id="uname"/><br>
pass:<input type="password" id="upass"/><br>
<input type="button" value="提交" id="inputs1"/><br>

<div id="divPass"></div>
</body>
</html>